<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 数字转换为十六进制数 -->
    <script>
      var toHex = function (num) {
        if (num === 0) return '0'
        let ans = ''
        const str = '0123456789abcdef'
        while (num) {
          ans = str[num & 0xf] + ans
          num >>>= 4
        }
        return ans
      }
      //var toHex = function(num) {
      //return (num >>> 0).toString(16)
      //};
      console.log(toHex(26))
    </script>
  </body>
</html>
